package javacompiler.syntax;

import java.util.LinkedList;
import java.util.List;

import java_cup.runtime.Symbol;

public class JavaSymbolInfo /*extends Symbol*/ {
	public enum LexType {
		Int, Float, String, Bool, Identifier, 
		Null, Super, This, Undefined;
	}
	
	
	public enum Modifier {
		Public, Private, Protected, Static, Final, 
		Native, Synchronized, Abstract, Threadsafe, 
		Transient;
	}
	
	private long id;
	private LexType type;
	private Double doubleValue;
	private Integer intValue;
	private String idValue;
	private String stringValue;
	private String variableType;
	private List<Modifier> modifiers;
	private String returnType;
	private String initializerType;
	// FIXME 
	private List<JavaSymbolInfo> identifiersInfo;
	private List<JavaSymbolInfo> parametersInfo;
	
	private int line;
	private int column;
	
	public JavaSymbolInfo() {
		/*super(0, , 0);*/
		type = LexType.Undefined;
		doubleValue = 0.0;
		parametersInfo = new LinkedList<JavaSymbolInfo>();
		modifiers = new LinkedList<Modifier>();
	}
	
	public void setId(long id) {
		this.id = id;
	}
	
	public long getId() {
		return id;
	}
	
	public void setType(LexType type) {
		this.type = type;
	}
	
	public LexType getType() {
		return type;
	}

	public Double getDoubleValue() {
		return doubleValue;
	}

	public void setDoubleValue(Double doubleValue) {
		this.doubleValue = doubleValue;
	}
	
	public Integer getIntValue() {
		return intValue;
	}

	public void setIntValue(Integer intValue) {
		this.intValue = intValue;
	}

	public String getIdValue() {
		return idValue;
	}

	public void setIdValue(String idValue) {
		this.idValue = idValue;
	}

	public String getStringValue() {
		return stringValue;
	}

	public void setStringValue(String stringValue) {
		this.stringValue = stringValue;
	}

	public String getVariableType() {
		return variableType;
	}

	public void setVariableType(String variableType) {
		this.variableType = variableType;
	}
	
	public void addIdentifierInfo(JavaSymbolInfo identifierInfo) {
		identifiersInfo.add(identifierInfo);
	}
	
	public List<JavaSymbolInfo> getIdentifiersInfo() {
		return identifiersInfo;
	}

	public void setIdentifiersInfo(List<JavaSymbolInfo> identifiersInfo) {
		this.identifiersInfo = identifiersInfo;
	}

	public void addParametersInfo(JavaSymbolInfo parameterInfo) {
		parametersInfo.add(parameterInfo);
	}
	
	public void setParametersInfo(List<JavaSymbolInfo> infos) {
		parametersInfo = infos;
	}
	
	public List<JavaSymbolInfo> getParametersInfo() {
		return parametersInfo;
	}
	
	public void setModifiers(List<Modifier> modifiers) {
		this.modifiers = modifiers;
	}
	
	public void addModifier(Modifier modifier) {
		modifiers.add(modifier);
	}
	
	public List<Modifier> getModifiers() {
		return modifiers;
	}
	
	public void setReturnType(String returnType) {
		this.returnType = returnType;
	}
	
	public String getReturnType() {
		return returnType;
	}
	
	public String getInitializerType() {
		return initializerType;
	}

	public void setInitializerType(String initializerType) {
		this.initializerType = initializerType;
	}

	@Override
	public String toString() {
		StringBuilder builder = new StringBuilder();
		builder.append("JavaSymbolInfo [type=");
		builder.append(type);
		builder.append(", doubleValue=");
		builder.append(doubleValue);
		builder.append(", intValue=");
		builder.append(intValue);
		builder.append(", idValue=");
		builder.append(idValue);
		builder.append(", stringValue=");
		builder.append(stringValue);
		builder.append(", variableType=");
		builder.append(variableType);
		builder.append("]");
		return builder.toString();
	}

	public int getLine() {
		return line;
	}

	public void setLine(int line) {
		this.line = line;
	}

	public int getColumn() {
		return column;
	}

	public void setColumn(int column) {
		this.column = column;
	}
}
